package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 74646
 * Date: 2022-02-09
 * Time: 20:37
 */

abstract class A{
    public abstract void funcA();
}
abstract class B extends A{
    public abstract void funcB();
}
class C extends B{
    @Override
    public void funcA() {

    }
    @Override
    public void funcB() {

    }
}
abstract  class Shape{
    int val = 10;
    public abstract void draw();

    public void func(){
        System.out.println("func()方法");
    }
}

class Rect extends Shape {
    @Override
    public void draw() {
        System.out.println("♦");

        //调用抽象类中的普通方法
        super.func();
    }
}

class Flower extends Shape {
    @Override
    public void draw() {
        System.out.println("❀");

        //调用抽象类中的成员变量
        System.out.println(val);
    }
}

public class Test {
    public static void drawMap(Shape shape){
        shape.draw();
    }
    public static void main(String[] args) {
        //向上转型
        Shape shape = new Rect() ;
        drawMap(shape);

        Flower flower = new Flower();
        drawMap(flower);
    }
}
